package com.borko.healthcare.entities.beans;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

import com.borko.healthcare.entities.interfaces.Medicine;
import com.borko.healthcare.entities.interfaces.Notification;
import com.borko.healthcare.entities.interfaces.Order;
import com.borko.healthcare.entities.interfaces.Pharmacist;
import com.borko.healthcare.entities.interfaces.UserDetails;

@Entity(name = "pharmacist")
@Table(name = "PHARMACISTS")
public class PharmacistBean implements Pharmacist {
	
	@Id @GeneratedValue
	@Column(name = "PHARMACIST_ID")
	private int id;
	
	@OneToOne(targetEntity = UserDetailsBean.class, optional = false)
	private UserDetails userDetails;
	
	@OneToMany(targetEntity = MedicineBean.class, mappedBy = "pharmacist")
	@LazyCollection(LazyCollectionOption.FALSE)
	private List<Medicine> medicines;
	
	@OneToMany(targetEntity = OrderBean.class, mappedBy = "pharmacist")
	@LazyCollection(LazyCollectionOption.FALSE)
	private List<Order> orders;
	
	@OneToMany(targetEntity = NotificationBean.class, mappedBy = "pharmacist")
	@LazyCollection(LazyCollectionOption.FALSE)
	private List<Notification> notifications;
	
	public PharmacistBean() {
		this.notifications = new ArrayList<Notification>();
		this.orders = new ArrayList<Order>();
		this.medicines = new ArrayList<Medicine>();
		userDetails = new UserDetailsBean();
	}

	public int getId() {
		return id;
	}

	public UserDetails getUserDetails() {
		return userDetails;
	}

	public void setUserDetails(UserDetails userDetails) {
		this.userDetails = userDetails;
	}

	public List<Medicine> getMedicines() {
		return medicines;
	}

	public void setMedicines(List<Medicine> medicines) {
		this.medicines = medicines;
	}

	public List<Order> getOrders() {
		return orders;
	}

	public void setOrders(List<Order> orders) {
		this.orders = orders;
	}

	public List<Notification> getNotifications() {
		return notifications;
	}

	public void setNotifications(List<Notification> notifications) {
		this.notifications = notifications;
	}
}
